package org.scirp.ijmis.dao.personpaper.impl;

import java.util.HashMap;
import java.util.Map;

import org.scirp.ijmis.dao.base.impl.BaseDAOImpl;
import org.scirp.ijmis.dao.personpaper.ITypeSettingDAO;
import org.scirp.ijmis.po.personpaper.TypeSetting;

public class TypeSettingDAOImpl extends BaseDAOImpl<TypeSetting> implements ITypeSettingDAO {
	private static final String className = TypeSettingDAOImpl.class.toString();

	public boolean saveOrUpdateTypeSetting(TypeSetting typeSetting) {
		return super.updateObject(typeSetting, className + "-->saveTypeSetting");
	}

	public TypeSetting selectByPaperId(Long paperId) {
		String hql = "from TypeSetting where paper.pid=:paperId order by pid desc";
		Map<String, Long> parameters = new HashMap<String, Long>();
		parameters.put("paperId", paperId);
		return (TypeSetting) super.selectSingle(hql, parameters, className + "-->selectByPaperId");
	}

	public boolean deleteTypeSetting(Long typeSettingId) {
		String hql = "delete from TypeSetting where pid=:pid";
		Map<String, Long> parameters = new HashMap<String, Long>();
		parameters.put("pid", typeSettingId);
		return super.ExecuteNonQuery(hql, parameters, className + "-->deleteTypeSetting(Long typeSettingId)");
	}

}
